<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <section>
        <h2>Bubbles</h2>
    </section>
    <script>
        function createBubble () {
            const section = document.querySelector('section')
            const createElement = document.createElement('span')

            let size = Math.random() * 60
            createElement.style.width = 20 + size + 'px'
            createElement.style.height = 20 + size + 'px'
            createElement.style.left = Math.random() * innerWidth + 'px'
            section.append(createElement)
            setTimeout(() => {
                createElement.remove()
            }, 4000);


            
        }
        setInterval(() => {
            createBubble()
        }, 50);
    </script>
</body>
</html>